﻿<meta name="viewport" content="width=device-width,initial-scale=1" />
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <link href="${pageContext.request.contextPath}/css/themes/default/easyui.css" rel="stylesheet" />
    <link href="${pageContext.request.contextPath}/css/themes/icon.css" rel="stylesheet" />
    <link href="${pageContext.request.contextPath}/css/themes/color.css" rel="stylesheet" />
    <link href="${pageContext.request.contextPath}/css/apply.css" rel="stylesheet" />
    <script src="${pageContext.request.contextPath}/script/jquery.min.js"></script>
    <script src="${pageContext.request.contextPath}/script/jquery.easyui.min.js"></script>
    <title>申请快递</title>
    <style>
	
    </style>
</head>
<body>
    <div class="server">
        <h3 class="apply_title">申请快递</h3>
        <form id="f">
       <table class="table">
        <input id="sp" name="sp" value="未审核" type="hidden"/>
        <input id="yszt" name="yszt" value="未揽件" type="hidden"/>
        <input id="ydqy" name="ydqy" value="暂无物流信息" type="hidden"/>
        <input id="pd" name="pd" value="" type="hidden"/>
        <input id="hsz" name="hsz" value="0" type="hidden"/>
            <tr>
                <td colspan="6" class="head">申请人信息</td>
            </tr>
            <tr>
                <td class="first">申请人<span class="xing">*</span>：</td>
                <td class="input"><input type="text" id="sqr" name="sqr"/></td>
                <td class="first">手机<span class="xing">*</span>：</td>
                <td class="input"><input type="text" id="sqrsj" name="sqrsj"/></td>
                <td class="first">揽件时间<span class="xing">*</span>：</td>
                <td class="input"><input type ="date" id="sqsj" name="sqsj"></td>
            </tr>
            <tr>
                <td colspan="6" class="head">收件人信息</td>
            </tr>
            <tr>
                <td class="first">收件人<span class="xing">*</span>：</td>
                <td class="input"><input type="text" id="sjr" name="sjr"/></td>
                <td class="first">手机<span class="xing">*</span>：</td>
                <td class="input" colspan="4"><input type="text" id="sjrsj" name="sjrsj"/></td>
            </tr>
            <tr>
                <td colspan="6" class="head">快递信息</td>
            </tr>
            <tr>
                <td class="first">快递区域<span class="xing">*</span>：</td>
                <td class="input">
                    <select id="kdqy" name="kdqy">
                        <option value="null">请选择</option>
                        <option>国内</option>
                        <option>河北省石家庄市</option>
                        <option>山东省济南市</option>
                        <option>辽宁省沈阳市</option>
                        <option>黑龙江省哈尔滨市</option>
                        <option>吉林省长春市</option>
                        <option>甘肃省兰州市</option>
                        <option>青海省西宁市</option>
                        <option>河南省郑州市</option>
                        <option>江苏省南京市</option>
                        <option>湖北省武汉市</option>
                        <option>湖南省长沙市</option>
                        <option>江西省南昌市</option>
                        <option>浙江省杭州市</option>
                        <option>广东省广州市</option>
                        <option>云南省昆明市</option>
                        <option>福建省福州市</option>
                        <option>海南省海口市</option>
                        <option>山西省太原市</option>
                        <option>四川省成都市</option>
                        <option>陕西省西安市</option>
                        <option>贵州省贵阳市</option>
                        <option>安徽省合肥市</option>
                    </select>
                </td>
                <td class="first">快递类型<span class="xing">*</span>：</td>
                <td class="input">
                    <select id="kdlx" name="kdlx">
                        <option value="null">请选择</option>
                        <option>文件</option>
                        <option>包裹</option>
                        <option>电器</option>
                        <option>果蔬</option>
                        <option>其他</option>
                    </select>
                </td>
                <td class="first">快递公司<span class="xing">*</span>：</td>
                <td class="input">
                    <select id="kdgs" name="kdgs">
                        <option value="null">请选择</option>
                        <option>天行猫</option>
                        <option>EMS</option>
                        <option>顺丰</option>
                        <option>圆通</option>
                        <option>申通</option>
                        <option>中通</option>
                        <option>天天</option>
                    </select>
                </td>
            </tr>
            <tr>
                <td class="first">邮编<span class="xing">*</span>：</td>
                <td class="input"><input type="text" id="yb" name="yb"/></td>
                <td class="first">邮寄地址<span class="xing">*</span>：</td>
                <td colspan="4" class="input"><input class="addr" type="text" id="yjdz" name="yjdz"/></td>
                
            </tr>
            <tr>
                <td colspan="6" class="head">申请说明</td>
            </tr>
            <tr>
                <td class="secend" style="height:60px;" colspan="6">
                    <textarea rows="4" cols="161" style="resize:none;" id="sqsm" name="sqsm"></textarea>
                </td>
            </tr>
            <tr>
                <td colspan="6" style="height:35px;">
         			<input type="button" class="easyui-linkbutton c1" style="width:50px;height: 30px;margin-left: 27%;" onclick="addexpress()" value="提交"/>
         			<input onclick="cz()" class="easyui-linkbutton c1" style="width:50px;height: 30px;margin-left: 27%;" value="重置"/>
                </td>
            </tr>
</table>
</form>
    </div>
    <script>
        $(function () {
            $(".apply_proaddr").hide();
            $(".apply_counaddr").hide();
        })
        $(".apply_range").change(function () {
            var name = $(this).val();
            console.log(name);
            if (name=="国内") {
                $(".apply_proaddr").show();
                $(".apply_counaddr").hide();
            } else if (name=="国外") {
                $(".apply_proaddr").hide();
                $(".apply_counaddr").show ();
            } else if (name=="请选择") {
                $(".apply_proaddr").hide();
                $(".apply_counaddr").hide();
            } 
        })
        
        
    	function addexpress(){
        	var formData = new FormData($("#f")[0]);
        	var sqrsj=$("#sqrsj").val();
        	var sjrsj=$("#sjrsj").val();
        	var yb=$("#yb").val();
				$.ajax({
					url:"${pageContext.request.contextPath}/express/addexpress",
					type:"POST",				
					data:formData,
					dataType:"json",
					async: false,
	                cache: false,
	                contentType: false,
	                processData: false,	
					success:function(data){
						alert("申请成功！！！");
						window.location.href="${pageContext.request.contextPath}/lodingexpress.html";	
					},
					error:function(){
					if(sqrsj.length!=11 || sjrsj.length!=11){
						alert("手机号码格式错了！");
					}
					if(yb.length!=6){
						alert("邮编格式错了！");
					}else
						alert("请查看是否有未填写的信息！申请失败！！！");
					}
				});
			}
			
        function cz(){
			window.location.reload();
		}
    </script>
</body>
</html>